import 'package:flutter/material.dart';
import '../utils/AppColors.dart';

typedef OnTap = Function();

class EmptyImgWidget extends StatelessWidget {
  final String? title;
  final OnTap? onTap;

  const EmptyImgWidget({super.key, this.title, this.onTap});

  @override
  Widget build(BuildContext context) {
    return InkWell(
      child: Container(
        alignment: Alignment.center,
        padding: const EdgeInsets.symmetric(vertical: 12.0, horizontal: 12.0),
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          crossAxisAlignment: CrossAxisAlignment.center,
          children: <Widget>[
            Image.asset('assets/images/ic_load_no_data.png',
                width: 230.0, height: 150.0),
            Text(
              title ?? '暂无数据',
              style:
                  const TextStyle(fontSize: 20, color: AppColors.color_333333),
            ),
          ],
        ),
      ),
      onTap: () {
        if (onTap != null) {
          onTap!();
        }
      },
    );
  }
}
